package com.zz.common.tools.box;

import com.zz.common.tools.box.runner.BpRunner;

import android.os.Handler;
 
public class BpBox extends BpRunner {
	protected Handler mListener;
	protected Object mUserData;

	protected BpBox(Handler listener, Object userData) {
		mListener = listener;
		mUserData = userData;
	}
	
	public static int runBox(BpBox box){
		return BpBoxManager.getInstance().startRunner(box);
	}
	
	public static void cancel(int runnerId){
		BpBoxManager.getInstance().stopRunner(runnerId);
	}
	
	public static void cancelAll() {
		BpBoxManager.getInstance().stopAll();
	}
	@Override
	public void stop() {
		mUserData = null;
		mListener = null;
		super.stop();
	}
}
